import request from "@/utils/request";

// 查询商品列表
export function listStoreProduct(query) {
  return request({
    url: "/business/storeProduct/list",
    method: "get",
    params: query,
  });
}

// 查询商品所有列表
export function listAllStoreProduct(query) {
  return request({
    url: "/business/storeProduct/listAll",
    method: "get",
    params: query,
  });
}

// 查询商品详细
export function getStoreProduct(id) {
  return request({
    url: "/business/storeProduct/getInfo/" + id,
    method: "get",
  });
}

// 新增/修改商品
export function addStoreProduct(data) {
  return request({
    url: "/business/storeProduct/addOrSave",
    method: "post",
    data: data,
  });
}

// 修改商品
export function updateStoreProduct(data) {
  return request({
    url: "/business/storeProduct/edit",
    method: "post",
    data: data,
  });
}
export function updateStoreProductId(data) {
  return request({
    url: "/business/storeProduct/isFormatAttr",
    method: "post",
    data: data,
  });
}

// 删除商品
export function delStoreProduct(id) {
  return request({
    url: "/business/storeProduct/remove/" + id,
    method: "get",
  });
}

// 查询商品属性列表
export function listShowStoreProductCategory(query) {
  return request({
    url: "/business/storeProduct/storeProductCategory",
    method: "get",
    params: query,
  });
}

// 生成sku
export function fromatAttrApi(id, data) {
  return request({
    url: "/business/storeProduct/isFormatAttr/" + id,
    method: "post",
    data: data,
  });
}
